

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script src="/wondershare/js/jquery.js"></script> 
<script src="/wondershare/js/ad.js"></script> 
<link href="/wondershare/styles/main.css" rel="stylesheet" type="text/css" />
<link href="/wondershare/styles/general.css" rel="stylesheet" type="text/css" />
<style>
table tr td{ text-align:center;}
</style>
<title></title>
<script type="text/javascript">
//设置显示和隐藏tr
function tr_toggle(tr_prefix, img_id,  is_one_products_category)
{
	if($("#"+img_id).attr('src') == 'http://cms.wondershare.com.br.wx/wondershare/images/menu_minus.gif')
	{
		$("#"+img_id).attr('src','http://cms.wondershare.com.br.wx/wondershare/images/menu_plus.gif'); 
		$("tr[id*='"+tr_prefix+"_']").each(function(){
			
			$(this).hide();
		});
		
		if(is_one_products_category == 1)//当为一级 分类选择时
		{
			$("img[id*='"+img_id+"_']").each(function(){
			
				$(this).attr('src','http://cms.wondershare.com.br.wx/wondershare/images/menu_plus.gif'); 
			});
		}
	}
	else if($("#"+img_id).attr('src') == 'http://cms.wondershare.com.br.wx/wondershare/images/menu_plus.gif')
	{
		$("#"+img_id).attr('src','http://cms.wondershare.com.br.wx/wondershare/images/menu_minus.gif'); 
		
		$("tr[id*='"+tr_prefix+"_']").each(function(){
			
			$(this).show();
		});
		
		if(is_one_products_category == 1)//当为一级 分类选择时
		{
			$("img[id*='"+img_id+"_']").each(function(){
			
				$(this).attr('src','http://cms.wondershare.com.br.wx/wondershare/images/menu_minus.gif'); 
			});
		}
		
	}
}

//设置前缀为checked_prefix的id全部选中
function set_checked(checked_prefix)
{
	if($("#"+checked_prefix).attr("checked") == false){
		
		 $("input[id*='"+checked_prefix+"_']").each(function(){
				
				$(this).attr("checked",false); 
		});
	}else if ($("#"+checked_prefix).attr("checked") == true)
	{
		$("input[id*='"+checked_prefix+"_']").each(function(){
				
				$(this).attr("checked",true); 
		});
	}
}


function get_checked_value()
{
	var  checked_value = '';
	$('[name = "delivery_list"]:checked').each(function(){

		if(this.value != null || this.value != '' )
		{
			if(checked_value == '')
			{
				checked_value = this.value;
			}else
			{
				checked_value += '$$'+this.value;
			}
		}
	
	});
	return checked_value;
 
}
	
function get_old_group_position()
{
  return $("#old_group_position").val();
}

function get_ad_id()
{
  
  return $("#ad_id").val();
}

function get_web_type()
{
  
  return $("#ad_id").val();
}



</script>
</head>
<body style="width:710px;">
<form method="POST" action="./ad.php?action=ad_position_list&w_type=<{$w_type}>">

    <img height="22" border="0" width="26" alt="SEARCH" src="../images/icon_search.gif">
    <!-- 推荐 -->
    <span style="margin-left:2px; font-size:13px; ">广告投放位置：</span><select name="ad_location"><option <{if $ad_location  eq "0|0|0" }> selected="selected" <{/if}>  value="0|0|0">所有位置</option>
	<{foreach from=$select_delivery_info item=info}>
    
        <option  <{if $ad_location eq '<{$info.position_id}>|0|<{$info.position_type}>'  }> selected="selected" <{/if}>  
        value="<{$info.position_id}>|0|<{$info.position_type}>" > -<{$info.position_name}></option>
        <{foreach from = $info.cat_info item=cat_info}>
            <option <{if $ad_location eq '<{$info.position_id}>|<{$cat_info.cat_id}>|<{$info.position_type}>' }>   selected="selected" <{/if}>  
            value="<{$info.position_id}>|<{$cat_info.cat_id}>|<{$info.position_type}>" > &nbsp;&nbsp;<{$cat_info.cat_title}></option>
        <{/foreach}>
	<{/foreach}>
	</select>
	
	<input type="hidden" name="w_type" id="w_type" value="<{$w_type}>" >
    <input name="new_group_position" id="new_group_position"  type="hidden" value="<{$new_group_position}>"/>
	<input name="old_group_position" id="old_group_position"  type="hidden" value="<{$old_group_position}>"/>
     <input type="submit" class="button"  name="search" value=" 搜索 ">

</form>
<form>
 <{if count($delivery_info_list) <= 0}>
  <h2 style="text-align:center;">没有数据</h2>
  <{else}>
  <br />
    <span style="margin-left:30px; font-size:14px">请勾选多选框投放广告：</span>
	

	<input type="hidden"  name="ad_id" id="ad_id" value="<{$ad_id}>">

   <table width="100%" cellspacing="1" cellpadding="2" id="list-table" class="list-div"  style="margin-top:10px;" >
  
    <tr>
     
      <th width="50%">广告位名称</th>
      <th width="40%">是否已经投放广告（广告名称）</th>
      <th width="10%">投放</th>
    </tr>
    <{foreach from=$delivery_info_list key=key item=info}>
    
	 <{if $info.position_type == 1}>
	   
          <tr>
          <td width="50%"><img src="http://cms.wondershare.com.br.wx/wondershare/images/menu_minus.gif"  id="img_<{$info.position_id}>" 
          onclick="tr_toggle('article_<{$info.position_id}>', 'img_<{$info.position_id}>', 0)" /> 文章广告位-<{$info.position_name}> </td>
          <td width="40%">选择文章分类投放</td>
          <td width="10%"><input type="checkbox" name="delivery_list"  onclick="set_checked('a_cat_<{$info.position_id}>')" id="a_cat_<{$info.position_id}>" value=""></td>
          </tr>
          <{foreach from=$info.cat_info item=cat_info}>
          <tr id="article_<{$info.position_id}>_<{$cat_info.cat_id}>">
          <td width="50%">&nbsp;&nbsp;文章分类：<{$cat_info.cat_title}></td>
          <td width="40%"><{$cat_info.ad_name}></td>
          <td width="10%"><{$cat_info.checkbox}></td>
          </tr>
          <{/foreach}>
          
          
	  <{elseif $info.position_type == 5}>
      
      	   <tr>
          <td width="50%"><img src="http://cms.wondershare.com.br.wx/wondershare/images/menu_minus.gif"   id="img_<{$info.position_id}>" 
          onclick="tr_toggle('products_<{$info.position_id}>', 'img_<{$info.position_id}>', 1)"/> 产品广告位-<{$info.position_name}> </td>
          <td width="40%">选择产品投放</td>
          <td width="10%"><input type="checkbox" name="delivery_list"  id="p_cat_<{$info.position_id}>" value=""  onclick="set_checked('p_cat_<{$info.position_id}>')"  ></td>
          </tr>
          <{foreach from=$info.cat_info item=cat_info}>
              <tr id="products_<{$info.position_id}>_<{$cat_info.cat_id}>">
              <td width="50%"> <img src="http://cms.wondershare.com.br.wx/wondershare/images/menu_minus.gif"  id="img_<{$info.position_id}>_<{$cat_info.cat_id}>"
              onclick="tr_toggle('products_<{$info.position_id}>_<{$cat_info.cat_id}>', 'img_<{$info.position_id}>_<{$cat_info.cat_id}>', 0)" /> 
              产品一级分类：<{$cat_info.cat_title}></td>
              <td width="40%"><{$cat_info.ad_name}></td>
              <td width="10%"><{$cat_info.cat_box}></td>
              </tr>
              <{foreach from=$cat_info.product item=p_info}>
                   <tr id="products_<{$info.position_id}>_<{$cat_info.cat_id}>_<{$p_info.id}>">
                  <td width="50%">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<{$p_info.product_name}></td>
                  <td width="40%"><{$p_info.ad_name}></td>
                  <td width="10%"><{$p_info.p_box}></td>
                  </tr>
          		<{/foreach}>
          <{/foreach}>

     
     <{else}>
	 <tr>
	  <td width="50%">- <{if $info.position_type == 2}>resource广告位 <{elseif $info.position_type == 3}>topic广告位 
      <{elseif $info.position_type == 4}> tag广告位<{elseif $info.position_type == 4}>ws的store广告位 <{else}> 其他广告位<{/if}> <{$info.position_name}></td>
      <td width="40%"><{$info.ad_name}></td>
      <td width="10%"><{$info.checkbox}></td>
	   </tr>
	 <{/if}> 
    
    <{/foreach}>
  </table>
<{/if}>
</form>
</body>
</html>
